﻿using System;
using System.Threading;

namespace Demo
{
    class Program
    {
       
        static void Main(string[] args)
        {

           
            var d = new SomeResource();
            d.Say();

            Console.ReadKey();

            Console.WriteLine("Hello World!");
        }
    }


    /// <summary>
    /// 一个自旋锁，里面的代码必须执行非常快 要不会阻止cpu做其他事情，不要在单个cpu上使用 1017
    /// </summary>
    public sealed class SomeResource {
        private SimpleSpinlock s1 = new SimpleSpinlock();

        public void Say()
        {
            s1.Enter();
            
            s1.Leave();
        }
    }



}
